<?php

require('httpheader.php');
require('../install/mysqldb.php');
header('Content-Type:application/json; charset=utf-8');

if($cin && $_GET){
    mysqli_select_db($cin,"hongbao");
    date_default_timezone_set('PRC');
    $id = $_GET["id"];
    $userlist = mysqli_query($cin,"SELECT * FROM userinfo WHERE id=$id");
    // var_dump($userlist);
    $data = array();
    if($userlist->num_rows){
        while($row = $userlist->fetch_row()){
            $result = detectionTime($row[6],$row[0],$cin);
            if(!$result){
                $problem = json_decode($row[7]);
                $list = ["uid"=>$row[0],"headurl"=>$row[2],"username"=>$row[3],"firstchoose"=>$problem->firstchoose,"problemset"=>$problem->problemset];
                if(array_key_exists("spoof",$problem)){
                    $list["spoof"] = $problem->spoof;
                }
                array_push($data,$list);
                $results = ["code"=>'200'];
            }
            
        }
        $results['data'] = $data;
    
    echo json_encode($results,JSON_UNESCAPED_UNICODE);
    }
}

?>